package com.plian.system.controller.pm.property;

import com.plian.Tools.base.BaseController;
import com.plian.system.dto.pm.property.PropertyChartDTO;
import com.plian.system.model.R;
import com.plian.system.service.pm.property.IPropertyChartService;
import com.plian.system.vo.pm.property.TypeQuantityChange;
import com.plian.system.vo.report.ChartsVO;
import com.plian.system.vo.report.PieChartVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: TODO
 * @Author: Take-off
 * @Date: 2023/5/23 3:01 PM
 * @Param
 * @return
 * @Version: 1.0
 **/
@RestController
@RequestMapping(value = "api/propertyChart")
@Api(value = "PropertyChartController", tags = "产权信息图表控制器")
@AllArgsConstructor
public class PropertyChartController extends BaseController {

    private final IPropertyChartService propertyChartService;

    @PostMapping(value = "/org-type-cake")
    @ApiOperation(value = "企业类型-饼图", notes = "传入DTO信息")
    public R<PieChartVO> getOrgTypeCake(@RequestBody PropertyChartDTO chartDTO) {
        return R.data(propertyChartService.getOrgTypeCake(chartDTO));
    }

    @PostMapping(value = "/pro-order-cake")
    @ApiOperation(value = "组织层级-饼图", notes = "传入DTO信息")
    public R<PieChartVO> getProOrderCake(@RequestBody PropertyChartDTO chartDTO) {
        return R.data(propertyChartService.getProOrderCake(chartDTO));
    }

    @PostMapping(value = "/nature-cake")
    @ApiOperation(value = "单位性质-饼图", notes = "传入DTO信息")
    public R<PieChartVO> getNatureCake(@RequestBody PropertyChartDTO chartDTO) {
        return R.data(propertyChartService.getNatureCake(chartDTO));
    }

    @PostMapping(value = "/change-line")
    @ApiOperation(value = "产权变动-折线图", notes = "传入DTO信息")
    public R<TypeQuantityChange> getProperChangeLine(@RequestBody PropertyChartDTO chartDTO) {
        return R.data(propertyChartService.getProperChangeLine(chartDTO));
    }

    @PostMapping(value = "/change-bar")
    @ApiOperation(value = "产权变动-柱状图", notes = "传入DTO信息")
    public R<ChartsVO> getProperChangeBar(@RequestBody PropertyChartDTO chartDTO) {
        return R.data(propertyChartService.getProperChangeBar(chartDTO));
    }

}
